package com.gt.quality.system.entity;

import cn.idev.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 用户信息表(SysUser)表实体类
 *
 * @author makejava
 * @since 2026-11-25 16:30:08
 */
@Data
@Accessors(chain = true)
@Schema(title = "SysUser", description = "EasyCode")
@TableName(value = "sys_user", autoResultMap = true)
@EqualsAndHashCode
public class SysUser implements Serializable {

    @Serial
	private static final long serialVersionUID = 1L;

    /**
     * Description:  用户ID
     */
    @Schema(title = "user_id",description = "用户ID")
    @TableId(value = "user_id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using= ToStringSerializer.class)
    private Long userId;

    /**
     * Description:  租户编号
     */
    @TableField(value = "tenant_id")
    @Schema(title = "tenant_id",description = "租户编号")
    private String tenantId;

    /**
     * Description:  部门ID
     */
    @TableField(value = "dept_id")
    @Schema(title = "dept_id",description = "部门ID")
    private Long deptId;

    /**
     * Description:  用户账号
     */
    @TableField(value = "user_name")
    @Schema(title = "user_name",description = "用户账号")
    @ExcelProperty(value = "用户名")
    private String userName;

    /**
     * Description:  用户昵称
     */
    @TableField(value = "nick_name")
    @Schema(title = "nick_name",description = "用户昵称")
    @ExcelProperty(value = "用户昵称")
    private String nickName;

    /**
     * Description:  用户类型（sys_user系统用户）
     */
    @TableField(value = "user_type")
    @Schema(title = "user_type",description = "用户类型（sys_user系统用户）")
    @ExcelProperty(value = "用户类型")
    private String userType;

    /**
     * Description:  用户邮箱
     */
    @TableField(value = "email")
    @Schema(title = "email",description = "用户邮箱")
    @ExcelProperty(value = "邮箱")
    private String email;

    /**
     * Description:  手机号码
     */
    @TableField(value = "phone_number")
    @Schema(title = "phone_number",description = "手机号码")
    @ExcelProperty(value = "手机号码")
    private String phoneNumber;

    /**
     * Description:  用户性别（0男 1女 2未知）
     */
    @TableField(value = "sex")
    @Schema(title = "sex",description = "用户性别（0男 1女 2未知）")
    @ExcelProperty(value = "性别")
    private String sex;

    /**
     * Description:  头像地址
     */
    @TableField(value = "avatar")
    @Schema(title = "avatar",description = "头像地址")
    @ExcelProperty(value = "头像")
    private Long avatar;

    /**
     * Description:  密码
     */
    @TableField(value = "password")
    @Schema(title = "password",description = "密码")
    @ExcelProperty(value = "密码")
    private String password;

    /**
     * Description:  帐号状态（0正常 1停用）
     */
    @TableField(value = "status")
    @Schema(title = "status",description = "帐号状态（0正常 1停用）")
    @ExcelProperty(value = "帐号状态")
    private String status;

    /**
     * Description:  删除标志（0代表存在 2代表删除）
     */
    @TableField(value = "del_flag")
    @Schema(title = "del_flag",description = "删除标志（0代表存在 2代表删除）")
    @TableLogic(value = "0", delval = "2")
    private String delFlag;

    /**
     * Description:  最后登录IP
     */
    @TableField(value = "login_ip")
    @Schema(title = "login_ip",description = "最后登录IP")
    private String loginIp;

    /**
     * Description:  最后登录时间
     */
    @TableField(value = "login_date")
    @Schema(title = "login_date",description = "最后登录时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime loginDate;

    /**
     * Description:  创建部门
     */
    @TableField(value = "create_dept")
    @Schema(title = "create_dept",description = "创建部门")
    private Long createDept;

    /**
     * Description:  创建者
     */
    @TableField(value = "create_by")
    @Schema(title = "create_by",description = "创建者")
    private Long createBy;

    /**
     * Description:  创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @Schema(title = "create_time",description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * Description:  更新者
     */
    @TableField(value = "update_by")
    @Schema(title = "update_by",description = "更新者")
    private Long updateBy;

    /**
     * Description:  更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @Schema(title = "update_time",description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    /**
     * Description:  备注
     */
    @TableField(value = "remark")
    @Schema(title = "remark",description = "备注")
    @ExcelProperty(value = "备注")
    private String remark;

}


